#include "epollServer.hpp"
#include <memory>

void Usage(string proc)
{
    cout << "Usage:\n\t" << proc << " serverport" << endl;
}

string handlerReq(const string& req)
{
    string response;
    response += "#server echo: ";
    response += req;
    response += "\n";
    return response;
}

int main(int argc, char* argv[])
{
    if (argc != 2)
    {
        Usage(argv[0]);
        exit(USAGE_ERR);
    }
    uint16_t port = atoi(argv[1]);
    unique_ptr<epollServer> svr(new epollServer(port, handlerReq));
    svr->initServer();
    svr->startServer();
    return 0;
}